import request from "@/utils/request";

const BASE_URL = "/admin";

const accountAPI = {
  /** 获取通知轮播分页数据 */
  getMultiGet(data?: any) {
    return request<any>({
      url: `/setting/multiGet`,
      method: "POST",
      data,
    });
  },
  /** 获取通知轮播分页数据 */
  getBalanceLogPage(data?: any) {
    return request<any, PageResult<PageVO[]>>({
      url: `${BASE_URL}//water/waterMeterBalanceLog/pageList`,
      method: "POST",
      data,
    });
  },

  /** 获取通知轮播分页数据 */
  getPage(data?: accountPageQuery) {
    return request<any, PageResult<PageVO[]>>({
      url: `${BASE_URL}/water/waterMeter/pageList`,
      method: "POST",
      data,
    });
  },

  /**
   * 批量删除
   *
   * @param ids IDs数组
   */
  deleteByIds(data: any) {
    return request({
      url: `${BASE_URL}/water/waterMeter/del`,
      method: "post",
      data,
    });
  },

  /**
   * 更新
   *
   * @param id ID
   * @param data 轮播组表单数据
   */
  update(data: Form) {
    return request({
      url: `${BASE_URL}/water/waterMeter/update`,
      method: "post",
      data,
    });
  },

  /**
   * 轮播组
   *
   * @param data 轮播组表单数据
   * @returns
   */
  add(data: Form) {
    return request({
      url: `${BASE_URL}/water/waterMeter/add`,
      method: "post",
      data,
    });
  },
  /**
   * 修改用户密码
   *
   * @param id 用户ID
   * @param password 新密码
   */
  resetPassword(data: any) {
    return request({
      url: `${BASE_URL}/user/waterMeter/updateLoginSecret`,
      method: "post",
      data,
    });
  },
};

export default accountAPI;

/** 分页查询参数 */
export interface accountPageQuery extends PageQuery {
  /** 标题 */
  s_holder_username?: string;
  /** code */
  s_code?: string;
  s_holder_id_card_no?: string;
  s_holder_tel?: string;
  s_address?: string;
  area_id?: string | number;
}

/** 分页对象 */
export interface PageVO {
  id: string;
  /** name */
  s_code?: string;
  /** code */
  code?: string;
  /** 备注 */
  remark?: string;
}

/**
 * 表单对象
 */
export interface Form {
  id?: string | number;
  holder_username: string;
  holder_id_card_no: string;
  holder_tel: string;
  area_id: string;
  address: string;
  water_number: string;
  balance: string;
  charge_rule_id: string;
  remark: string;
}
